<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            font-family: cursive;
        }
    </style>
</head>
<body>

<script>

    var num=prompt("请输入图形的行数");
    for (var j=0;j<num;j++){
        var t=num-j-1;
        for (var i=0;i<t;i++){  //4 3 2 1 0
            document.write("&nbsp");
        }
        var e=(j+1)*2-1;
        for (var s=0;s<e;s++){   //1 3 5 7 9
            document.write("*");
        }
        document.write("<br>")
    }

</script>
</body>
</html>